#ifndef __SPRITEMANAGER_H
#define __SPRITEMANAGER_H

#include <list>
#include "sprite.h"
#include "contact.h"
#include "player.h"
#include "boss.h"
#include "puppetController.h"

#define EVENT_SPAWN_ITEM  0
#define EVENT_PLAYER_DEAD 1
#define EVENT_GAME_OVER   2

class SpriteManager : public ContactListener
{
	public:
		static SpriteManager &getInstance();
		~SpriteManager();
		std::list<Sprite *> &getObjectList();
		void setPlayer(Player *p);
		void setBoss(Boss *b);
		void addObject(Sprite *d);
		void removeObject(Sprite *d);
		Sprite *findObject(Sprite *d);
		void addPuppetController(PuppetController *pc);
		void draw();
		void update(Uint32 ticks);
		bool onContact(Contact &data);
		void init();
		void restart();
		void addItemPickup(Vector2f &pos);
		void removePuppetController(Puppet *p);

	private:
		SpriteManager();
		SpriteManager(const SpriteManager&);
		SpriteManager &operator=(const SpriteManager&);
		std::list<Sprite *> objects;
		std::list<PuppetController *> puppetControllers;
		Player *player;
		Boss *boss;
};

Uint32 gameOverCallback(Uint32 interval, void *param);

#endif // !__SPRITEMANAGER_H
